package com.youxin.logprocess.bean;


/**
 * 主机访问次数监控
 * @author yingde.cao
 *
 */
public class HostVisitBean {	
	
	private String ip;
	private long times;
	
	public HostVisitBean()
	{		
	}
	
	public HostVisitBean(String ip,long times)
	{
		this.ip=ip;
		this.times=times;
	}
	
	public String getIp() {
		return ip;
	}
	
	public void setIp(String ip) {
		this.ip = ip;
	}
	public long getTimes() {
		return times;
	}
	public void setTimes(long times) {
		this.times = times;
	}
	
	public void incrementTimes()
	{
		this.times+=1;
	}
	
	@Override
	public boolean equals(Object obj) {
		if(obj instanceof HostVisitBean)
		{
			HostVisitBean visitBean=(HostVisitBean)obj;
			return ip.equals(visitBean.getIp());
		}
		return false;
	}
	
	@Override
	public int hashCode() {
		return ip.hashCode();
	}
	
	@Override
	public String toString() {
		return String.format("ip=%s,times=%d", ip,times);
	}
	
}
